package com.xl.utils.rabbitmq.consumer;

import com.xl.utils.rabbitmq.service.IAmqpHelloService;
import com.xl.utils.util.QueueConstant;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author xionglin
 * @Classname AmqpServiceConsumer
 * @Description TODO
 * @Date 2019/6/21 15:18
 */
@Slf4j
@Component
public class AmqpServiceConsumer {
    //private Logger logger = LoggerFactory.getLogger(AmqpServiceConsumer.class);
    @Autowired
    private IAmqpHelloService amqpHelloService;

    public AmqpServiceConsumer() {
    }

    @RabbitListener(queues = QueueConstant.QUEUE_NOTIFY_HELLO)
    public void receiveSmsCodeQueue(String message) {
//        this.logger.info("------hello：消费者处理消息------");
//        this.logger.debug(message);
        log.info("消费者处理消息:{}",message);
        this.amqpHelloService.receiveHelloQueue(message);
    }
}
